package hn.cch.message;

public class JsonResponse {

    private String code;
    private Object data;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public static JsonResponse success(Object object){
        JsonResponse jsonResponse = new JsonResponse();
        jsonResponse.setCode("success");
        jsonResponse.setData(object);
        return jsonResponse;
    }

    public static JsonResponse error(Object object){
        JsonResponse jsonResponse = new JsonResponse();
        jsonResponse.setCode("error");
        jsonResponse.setData(object);
        return jsonResponse;
    }
}
